/**
 * https://promisesaplus.com/
 */

const MyPromise = require("./MyPromise.js")

let promise = new MyPromise((resolve, reject) => {
    // executor
    // resolve("success")
    // reject("error")

    // 异步
    setTimeout(() => {
        resolve("Success")
    }, 2000)
})

promise.then((result) => {
    console.log("1FulFilled: " + result)
}, (reason) => {
    console.log("Rejected: " + reason)
})

promise.then((result) => {
    console.log("2FulFilled: " + result)
}, (reason) => {
    console.log("Rejected: " + reason)
})